<? session_start();
						
include_once ('core/conn.php');
						
$db = get_conn();
						
check_session();
						
if($_GET['id'] != ''){
							
	$sql = " select * from locations where id_location=".$_GET['id']; 
							
	$result = mysql_query($sql);	
							
	if($result){
								
		$row = mysql_fetch_array($result);
		$id_location = $row['id_location'];
		$id_facility = $row['id_facility'];
		$number = $row['number'];
		$acc_id = $row['acc_id'];
		$interfon = $row['interfon'];

		$id_user = get_owner($id_location);
		
	}else{
								
		error_handling($sql,mysql_error());
							
	}
						
}
						
						
					
?>
					
					
<html>
					
<head>
<link href="tools/modal/base.css" type="text/css" rel="stylesheet" />
<link href="tools/modal/modal-window.css" type="text/css" rel="stylesheet" />
<script src="tools/modal/jquery-1.4.2.js"     type="text/javascript"></script>
<script type="text/javascript" lang="javascript" src="tools/modal/modal-window.min.js"></script>
					
					

				
				
<script>
					
<!--
						
	function checkdata(obj){
						
							

						
							
		if(obj.number.value ==''){
								
			alert('Debe indicar el numero de casa');
								
			obj.number.focus();
								
			return false;
							
		}
							


	return true;
						
	}
	
	
	function refresh_Owner(id_user){

		url = "ajax_comps/helper/owner.php?id="+id_user; 
		$("#owner_layer").load(url);	
		
	}					
-->
					
</script>
					
</head>									
					
<body>														
				
				
<form name='locations' method='post' action='/core/locations.php' onsubmit='return checkdata(this)'>
  <table width='50%' border='0' align="left">
    <tr>
      <td width="13%" align='left'>Desarrollo:</td>
      <td width="87%" align='left'><? 

			$sql="select id_facility as myvalue, concat(ft.name ,' ', f.name) as mydesc  
					from facilities f , `facility_type` ft 
					where f.id_ftype = ft.id_ftype";
				echo dbcombosql($sql,"id_facility",$id_facility,$javascript,$extraitems);				
				
				
			?>
    </tr>
    <tr>
      <td align='left'> Numero Casa:</td>
      <td align='left'><input type='text' name='number' value='<? echo $number;?>'>
      <input type='hidden' name='id_location' value='<? echo $id_location;?>'></td>
    </tr>
    <tr>
      <td align='left' nowrap>Numero Contrato:</td>
      <td align='left'><input type='text' name='acc_id' value='<? echo $acc_id;?>'></td>
    </tr>
    <tr>
      <td colspan='2' align='center'><?
							  
					if ($_GET['id'] != ""){
								
						echo "<input type='submit' name='Actualizar' value='Actualizar'>";
								
						echo "<input type='submit' name='Eliminar' value='Borrar'>";										
								
						echo "<input type='submit' name='Nuevo' value='Cancelar'>";
							  
					}else{
								
						echo "<input type='submit' name='Agregar' value='Agregar'>";
						echo "<input type='button' name='Nuevo' value='Cancelar' onClick=\"document.location.href='locations.php'\">";
					}
							 
					?>  </td>
    </tr>
    <tr>
      <td colspan='2' align='center'>&nbsp;</td>
    </tr>
  </table>
</form>
					
</body></html>													
					